package com.kitbox.hl.meshow.datadic.service.impl;

import com.kitbox.hl.meshow.datadic.dao.DataDicMapper;
import com.kitbox.hl.meshow.datadic.service.DataDicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Auther: honglei
 * @Date: 2019/8/21 16:53
 * @Description:
 */
@Service
public class DataDicServiceDbImpl implements DataDicService {
    @Autowired
    private DataDicMapper dataDicMapper;

    @Override
    public int updateOrinsert(Map map) {
        if (map==null||map.size()==0) {
            return 0;
        }
        if (map.containsKey("id")){
            return updateDataDic(map);
        }else {
            return insertDataDic(map);
        }
    }

    @Override
    public List<Map> queryDataDic(String group) {
        return dataDicMapper.queryDataDic(group);
    }

    @Override
    public Map queryDataDic(String group, String vCode) {
        return dataDicMapper.queryDataDic(group,vCode);
    }

    @Override
    public int updateDataDic(Map map) {
        return dataDicMapper.updateDataDic(map);
    }

    @Override
    public int insertDataDic(Map map) {
        return dataDicMapper.insertDataDic(map);
    }
}
